<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>我发起的</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no,email=no" />
		<link rel="stylesheet" href="../css/mui.min.css">			
		<link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />
		<link rel="stylesheet" href="../fonts/iconfont.css" />
		<link rel="stylesheet" href="../css/OA.css" />
		
	</head>
	<body>
		<script src="../js/mui.min.js"></script>
		<script src="../js/mui.picker.min.js"></script>
		<script src="../js/app.js"></script>
		<script type="text/javascript" charset="utf-8">
			 //mui初始化
			mui.init();
						
		</script>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">我发起的</h1>
		</header>
		<div class="mui-content transparent">
			<ul class="mui-table-view" id="rows">
				<!--<li class="mui-table-view-cell mui-media">
					<a data-href="www.baidu.com/con?1" class="c-href"> 
						<span class="mui-media-object mui-pull-left iconfont icon-qingjia2"></span>
						<div class="mui-media-body">
							<div class="name-time">
							<span class="user-name">小鱼的<span ="">请假</span></span><span class="user-time">2014/12/10</span>
							</div>
							<p class='mui-ellipsis'>审批完成(<span>同意</span>)</p>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a data-href="www.baidu.com/con?1" class="c-href"> 
						<span class="mui-media-object mui-pull-left iconfont icon-gongzuo"></span>
						<div class="mui-media-body">
							<div class="name-time">
							<span class="user-name">小鱼的<span ="">加班</span></span><span class="user-time">2014/12/10</span>
							</div>
							<p class='mui-ellipsis'>审批完成(<span>同意</span>)</p>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a data-href="www.baidu.com/con?1" class="c-href"> 
						<span class="mui-media-object mui-pull-left iconfont icon-baoxiao2"></span>
						<div class="mui-media-body">
							<div class="name-time">
							<span class="user-name">小鱼的<span ="">报销</span></span><span class="user-time">2014/12/10</span>
							</div>
							<p class='mui-ellipsis'>审批完成(<span>同意</span>)</p>
						</div>
					</a>
				</li>--> 
			</ul>
		</div>		
		<script>
		
			mui.plusReady(function() {
				/*页面跳转*/
				mui('.mui-content').on('tap', '.c-href', function() {
						console.log("进来了"); 
						var href=this.getAttribute('data-href').toLowerCase(),
							id;
						if(href.indexOf('com')>=0){
							console.log("进来了"); 	
							id=href.split('www.baidu.com/?')[1]; 
							console.log(id);
							
//							showProduct(id);
						 	himall.openVW('start-msg.html','',{topicId:id});
													
						} 
						else{
							plus.runtime.openURL(href);
							
						}
				});
				var userId=plus.storage.getItem("userId")
				var rows=document.getElementById('rows'),
					w=plus.nativeUI.showWaiting('',{padlock:true})
					
				mui.ajax(url+'OA/GetExamine',{
								dataType:'json',
								type:'get',
								data:{
									userId:userId,
									webToken:'rqlh'
									},
								timeout:10000,
								success:function(data){	
									
									if(data.Code=="000"){ 
										var dataLen=data.Data.length;
										var row=''; 
										console.log(data.Data)
										console.log("请求成功");
										w.close();
										for (var i = 0; i < dataLen; i++) {
											var icon;
											/*截取类型*/
											var type=data.Data[i].title.substr(0,2)
											/*截取时间*/
											var time=data.Data[i].begintime.substr(0, 10)
						            		if(type==="请假"){
						            			icon="icon-qingjia2";
						            			
						            		}						            		
						            		if(type==="加班"){ 
						            			icon="icon-gongzuo";
						            			
						            		}
						            	 	if(type==="报销"){
						            			icon="icon-baoxiao2";
						            		}
						            	 	
						            		row += '<li class="mui-table-view-cell mui-media">'
						            			+'<a class="c-href" data-href="www.baidu.com/?'+data.Data[i].flowId+'">'
						            			+'<span  class="mui-media-object mui-pull-left iconfont '+icon+' "></span>'
						            			+'<div class="mui-media-body"><div class="name-time">我的'+type+'</span></span>'
						                		+'<span class="user-time">'+time+'</span></div><p class="mui-ellipsis"><span>'+data.Data[i].status+'</span></p>'
												+'</div></a></li>'												
										}
										console.log(row);
										rows.innerHTML=row;
//										
									}else{
										w.close(); 
										plus.nativeUI.toast(data.Msg);
									}
								},
								error:function(xhr,type,errorThrown){
									plus.nativeUI.toast("连接服务器失败,请检查网络");
									w.close();   
								}
								   
									  
					}); 
			})
		</script>
	</body>
</html>
